<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script type="text/javascript">
description("WebSocket: Test server-initiated close.");

window.jsTestIsAsync = true;

var ws = new WebSocket("ws://127.0.0.1:8880/server-close");
var closeEvent;

ws.onopen = function()
{
    debug("Connected");
};

ws.onmessage = function(messageEvent)
{
    debug("Received: " + messageEvent.data);
};

ws.onclose = function(event)
{
    debug("Closed");
    closeEvent = event;
    shouldBeTrue("closeEvent.wasClean");
    finishJSTest();
};

</script>
</body>
</html>
